import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import { HttpExceptionFilter } from "./filters/error.filters";
import { TransformInterceptor } from "./interceptor/transform.interceptor";
import { WsAdapter } from "./websocket/ws.adapter";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  //过滤器
  app.useGlobalFilters(new HttpExceptionFilter());

  //拦截器
  app.useGlobalInterceptors(new TransformInterceptor());
  //跨域
  app.enableCors();
  //swagger
  app.useWebSocketAdapter(new WsAdapter(app));

  await app.listen(3000);
}
bootstrap();
